package com.demo.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonIgnore;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * 基础实体类
 * 
 *
 */
@Getter
@Setter
public class BaseEntity implements Serializable{

    /**
     *
     */
    private static final long serialVersionUID = 8038869074494767719L;

    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "主键")
    protected Long id;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    protected LocalDateTime createTime;
    
    @ApiModelProperty(value = "修改时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    protected LocalDateTime updateTime;

    @JsonIgnore
    @ApiModelProperty(value = "创建人", hidden = true)
    @TableField(value = "create_user", fill = FieldFill.INSERT)
    protected Long createUser;
    
    @JsonIgnore
    @ApiModelProperty(value = "修改人", hidden = true)
    @TableField(value = "update_user", fill = FieldFill.INSERT_UPDATE)
    protected Long updateUser;

    @ApiModelProperty(value = "创建人名称")
    @TableField(exist = false)
    protected String createUserName;
    
    @ApiModelProperty(value = "修改人名称")
    @TableField(exist = false)
    protected String updateUserName;

    @ApiModelProperty(value = "逻辑删除", hidden = true)
    @TableLogic
    protected Integer state;

}
